home *** CD-ROM | disk | FTP | other *** search
/ Video Toaster 4.2 / Video Toaster v4.2.iso / arexx / editor / stopframe.rexx < prev    next >
OS/2 REXX Batch file  |  1995-12-22  |  5KB  |  153 lines

  1. /* StopFrame.rexx V3.0 -- Grabs frames on cue from GPI trigger for stop-motion animation */
  2. /* Originaly by Arnie Cachelin © 1992 NewTek Inc.                                        */
  3. /* 4.0 Version by Bob Caron (Grue) © 1995 NewTek Inc.    (REXX LIVES!!!!!!!)             */
  4.  
  5. /*
  6.  
  7.    This program will grab and save frames on cue from the GPI trigger.
  8.    If you enter a number to grab, it will save that many then exit.
  9.    Otherwise, 3 frames will be saved, then the prog. will exit.  Since
  10.    the Toaster is waiting for GPI input most of the time, it will not
  11.    respond  to anything else, which you may find annoying.  You can easily
  12.    give  your Toaster GPI pulses by attaching a spare mouse or joystick to
  13.    the second mouse port then clicking the button.  You can also find long
  14.    joystick extender cables at places like Radio Shack.
  15.  
  16.    To grab frames for a Claymation(TM) of stop-motion style animation, setup your
  17.    camera and 'actors', hook up a GPI trigger, and start this script with
  18.    appropriate arguments.  When your first frame is ready, hit the trigger
  19.    to grab and save it.  The toaster will then go into an 'onionskin' mode
  20.    where the camera is half dissolved over the last frame for ease of
  21.    positioning the actors.  When you hit the GPI again, the Toaster will leave
  22.    onionskin mode and grab the next frame, then return to onionskin mode.
  23.  
  24.    For best results, watch out for stray shadows, or shadows from the sun which
  25.    will change over the course of your shoot.
  26.  
  27. */
  28.  
  29. OPTIONS RESULTS
  30.  
  31. call remlib('ToasterARexx.port')
  32. call remlib('PROJECT_REXX_PORT')
  33.  
  34. call addlib('PROJECT_REXX_PORT' , 0)
  35. call addlib("ToasterARexx.port" , 0)
  36.  
  37. call set_view(2)
  38. call req_error("StopFrame V3.0     ---    Create stop-frame animation as a sequence of image files..")
  39.  
  40. rx startfilereq("Save Frames Where?","Toaster:Images","StopMotion.")
  41.  
  42. exit=1
  43. do while exit=1
  44.   name=queryfilereq()
  45.   if name=0 then call quit
  46.   if name~="" then exit=0
  47.   address command "c:wait 1"
  48. end
  49.  
  50. call req_error("Example: 150 frames = 5 seconds.")
  51.  
  52. count=0
  53. do while(count<1)
  54.    count=req_number("Number Of Frames To Grab",100)
  55.    if count=0 then call quit()
  56.    if count="CANCEL" then call quit()
  57.    end
  58.  
  59. call req_error("")
  60.  
  61. startframe=0
  62. do while(startframe<1)
  63.    startframe=req_number("Starting Frame #",1)
  64.    if startframe=0 then call quit()
  65.    if startframe="CANCEL" then call quit()
  66.    end
  67.  
  68. vidinput="-1"
  69. buttons='1000'
  70. do while vidinput="-1"
  71.   buttons=req_buttons("Choose Input:",buttons,"Main 1","Main 2","Main 3","Main 4")
  72.   if buttons="CANCEL" then call quit
  73.   if buttons="1000" then do
  74.      vidinput="001"
  75.      end
  76.   if buttons="0100" then do
  77.      vidinput="002"
  78.      end
  79.   if buttons="0010" then do
  80.      vidinput="003"
  81.      end
  82.   if buttons="0001" then do
  83.      vidinput="004"
  84.      end
  85. end
  86.  
  87. inputp="P"||vidinput
  88. inputm="M"||vidinput
  89.  
  90. format=-1
  91. buttons='10'
  92. do while format=-1
  93.   buttons=req_buttons("Choose File Format:",buttons,"24Bit IFF","Framestore")
  94.   if buttons="CANCEL" then call quit
  95.   if buttons="10" then do
  96.      format=0
  97.      end
  98.   if buttons="01" then do
  99.      format=1
  100.      end
  101. end
  102.  
  103. if req_tell("Notice!","Make sure your GPI trigger is","connected to the 2nd mouse port.")=0 then call quit
  104. call req_error("Note: Once you begin this process you can't abort without rebooting your machine.")
  105. if req_tell("Click 'Continue' to begin.")=0 then call quit
  106.  
  107. Switcher(TOSW)        /* Go to Switcher screen */
  108. Switcher(inputp)
  109. Switcher(inputm)
  110. Switcher(LVID)
  111. Switcher(PDV1)
  112. Switcher(inputp)
  113. i=startframe
  114. call req_open("Hit GPI trigger to grab current frame.")
  115. call req_error("StopMotion:  Current Frame ("||i||")   Frames to go ("||((startframe+count)-1)-i||")")
  116. Do i=startframe to (startframe+count)
  117.   Switcher(FVID)        /* Freeze frame */
  118.   Frame=right(trim(i),3,"0")
  119.   Fname=strip(name)||right(i,3,'0')
  120.   if format=0 then
  121.     t=switcher(SRGB,fname,0,5)
  122.   else
  123.     t=switcher(FMSV,fname,4)
  124.   call req_close()
  125.   call req_open("Hit GPI trigger to grab current frame.")
  126.   Switcher(inputp)
  127.   Switcher(MDV1)
  128.   Switcher(TBAR,255)
  129.   call req_error("StopMotion:  Current Frame ("||i||")   Frames to go ("||(startframe+count)-i||")")
  130.   if i=(startframe+count) then break
  131.   Switcher(WAIT,GPI)    /* Wait for GPI trigger to come in */
  132.   Switcher(TAKE)
  133.   Switcher(LVID)        /* Set to live digital video */
  134.   Switcher(PDV1)
  135.   Switcher(inputp)
  136.   Switcher(FRES)
  137.   Switcher(WAIT,60)
  138. end
  139.  
  140. call req_close()
  141. call req_error("")
  142.  
  143. call req_error("All done.")
  144.  
  145. quit:
  146. call req_close()
  147. call req_error("Canceled.")
  148. call remlib('PROJECT_REXX_PORT')
  149. call remlib('ToasterARexx.port')
  150.  
  151. exit
  152.  
  153.